﻿using Microsoft.EntityFrameworkCore;
using Vaccination.API.Infrastructure.EntityConfigurations;
using Vaccination.API.Repositories;

namespace Vaccination.API.Infrastructure
{
    public class VaccinationDbContext : DbContext
    {
        public DbSet<VaccinationInfo> VaccinationInfos => Set<VaccinationInfo>();

        public VaccinationDbContext(DbContextOptions<VaccinationDbContext> options)
        : base(options)
        {
            // No need for change tracking.
            ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
        }
        //protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
        //{
        //    configurationBuilder.Properties<string>().HaveMaxLength(128);
        //}
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new VaccinationInfoEntityTypeConfiguration());
        }
    }
}
